import { http } from '@/utils/http';
import { User } from '@/service/types/user';

/** 获取用户列表 */
export const GetUserPage = (data, query) => {
  return http.post<IResDataInfo<User.UserInfoQueryUserDetail>>('/user-info/getUserPage', data, query)
}

/** 查询用户详情 */
export const UserInfoQueryUser = (data: {
  /** 查询用户id */
  id: string;
}) => {
  return http.get<User.UserInfoQueryUserDetail>('/user-info/queryUser', data)
}

/** 喜欢、收藏、不喜欢、取消收藏 */
export const UserBehaviorInfo = (data: {
  /** 用户ID */
  userId: string;
  /** 行为类型(like:喜欢, collect：收藏, unlike:不喜欢, noCollect：取消收藏, chat:聊天, view：查看) */
  actionType: string;
  /** 被喜欢人id */
  actorId: string;
}) => {
  return http.post<User.UserBehaviorInfo>('/user-behavior-info', data)
}

/** 新增用户问题反馈 */
export const UserFeedbackInfo = (data) => {
  return http.post<any>('/user-feedback-info', data)
}

/** 获取每日推荐用户表分页 */
export const GetDailyRecommendationUserInfoPage = (data) => {
  return http.get<User.DailyRecommendationUserInfoPageItem[]>('/user-partner-preferences/queryReferenceList', data)
}

/** 获取用户置顶配置表详情 */
export const QueryUserTopConfigInfoByUserId = (data) => {
  return http.get<any>('/user-top-config-info/queryUserTopConfigInfoByUserId', data)
}

/** 刪除个人形象表 */
export const DeletePersonalImageryInfo = (data) => {
  return http.delete<any>('/personal-imagery-info', data)
}

/** 身份认证 */
export const IdentityVerification = (data) => {
  return http.post<any>('/identity-verification/identityVerification', data)
}

/** 通过编码关联用户电话 */
export const ConcatPhoneByCode = (data) => {
  return http.get<any>('/user-profile-info/concatPhoneByCode', data)
}

/** 修改用户档案表 */
export const UpdateUserProfileInfo = (data) => {
  return http.put<any>('/user-profile-info', data)
}

/** 修改用户表 */
export const UpdateUserInfo = (data) => {
  return http.put<any>('/user-info', data)
}

/** 获取用户凭证 */
export const GetGenerateUserSig = (data) => {
  return http.post<any>('/chat/generateUserSig', {}, data)
}

/** 腾讯IM聊天消息列表 */
export const GetRecentContacts = (data) => {
  return http.post<any>('/chat/recentContacts', data)
}

/** 聊天会话列表 */
export const GetLocalImChatList = (data) => {
  return http.get<any>('/chat/getLocalImChatList', data)
}

/** 获取聊天历史记录 */
export const GetLocalImChatHistory = (data) => {
  return http.get<any>('/chat/getLocalImChatHistory', data)
}

/** 发送消息 */
export const SendMessage = (data: {
  /** 发送人 */
  fromUser: string;
  /** 接收人 */
  toUser: string;
  /** 消息 */
  message: string;
}) => {
  return http.post<any>('/chat/sendMessage', {}, data)
}

/** 绑定手机号 */
export const GetBindPhoneUserId = (data: {
  userIdA: string;
  userIdB: string;
}) => {
  return http.get<any>('/aliyunDypls/bindPhoneUserId', data)
}

// 添加用户择偶要求
export const UpdatePreferences = (data) => {
  return http.post<any>('/user-partner-preferences', data)
}

/** 获取用户择偶要求表详情 */
export const GetPreferencesQueryByUserId = (data) => {
  return http.get<User.PreferencesDetail>('/user-partner-preferences/queryByUserId', data)
}

/** 关联用户电话 */
export const ConcatPhone = (data: {
  userId: string;
  phone: string;
}) => {
  return http.get<any>('/user-profile-info/concatPhone', data)
}

/** 获取身份认证详情 */
export const QueryIdentityVerification = (data: {
  userId: string;
}) => {
  return http.get<User.QueryIdentityVerificationData>('/identity-verification/queryIdentityVerification', data)
}

/** 发送消息-消费现金 */
export const ReduceMoney = (data: any) => {
  return http.post<any>('/user-balance-info/reduceMoney', data)
}

/** 用户接收虚拟通话配置 */
export const AddVirtualCall = (data: any) => {
  return http.post<any>('/user-virtual-call-config-info/addVirtualCall', data)
}

/** 通过用户id获取用户接收虚拟通话配置表详情 */
export const QueryByUserId = (data: any) => {
  return http.get<any>('/user-virtual-call-config-info/queryByUserId', data)
}

/** IM登录 */
export const LoginLocalIm = (data: any) => {
  return http.get<any>('/chat/loginLocalIm', data)
}

/** 通过编码获取用户电话 */
export const GetPhoneByWechatCode = (data: any) => {
  return http.get<any>('/user-profile-info/getPhoneByWechatCode', data)
}
